#include "Splash.h"
#include "ui_Splash.h"

using namespace std;

/**
 * @brief Splash::Splash
 * @param parent
 */
Splash::Splash(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Splash)
{
    ui->setupUi(this);

    /*
    Se elimina el borde de la ventana. Para quitar los otros botones,
    mirar las opciones de http://doc.qt.digia.com/4.6/widgets-windowflags.html
    */
    setWindowFlags(Qt::FramelessWindowHint);
    setWindowIcon(QIcon("://Icons/logo_principal.png"));

    ui->progressBar->setValue(0);

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(TimerEvent()));
    timer->start(15);

//    ui->label->setPixmap(QPixmap("://Images/siti-logo-splash.png"));
    setStyleSheet("background-image: url(://Images/siti-logo-splash.png);");
}

/**
 * @brief Splash::~Splash
 */
Splash::~Splash()
{
    delete ui;
}

/**
 * @brief Splash::TimerEvent
 */
void Splash::TimerEvent()
{
    int value = ui->progressBar->value();
    ui->progressBar->setValue(value+1);
}
